package models

import (
	"github.com/astaxie/beego/orm"
	_ "github.com/go-sql-driver/mysql"
)

//表的设计
type User struct { //用户信息表结构体
	Id   int
	Name string
	Pwd  string
}

func init() {
	//设置数据库基本信息
	_ = orm.RegisterDataBase("default", "mysql", "root:kk123456yy@tcp(127.0.0.1:3306)/blogweb_gin?charset=utf8")
	//映射model数据
	orm.RegisterModel(new(User)) //orm.RegisterModel(new(User),new(User1)...)
	//生成表
	_ = orm.RunSyncdb("default", false, true)
}
